﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Searches;

namespace Tests
{
    [TestClass]
    public class StringOperationsTests
    {
        [TestMethod]
        public void SwitchWordPairsTest()
        {
            Assert.AreEqual("cd   ab kd ef kk", "ab   cd ef kd kk".SwitchWordPairs());
        }

        [TestMethod]
        public void IndexOfTest1()
        {
            Assert.AreEqual(-1, "jopa tigra".IndexOfSubstring("jop1"));
        }

        [TestMethod]
        public void IndexOfTest2()
        {
            Assert.AreEqual(0, "jopa tigra".IndexOfSubstring("jopa"));
        }

        [TestMethod]
        public void IndexOfTest3()
        {
            Assert.AreEqual(5, "jopa tigra".IndexOfSubstring("tigra"));
        }

        [TestMethod]
        public void ChangeWordOrderTest()
        {
            Assert.AreEqual("Ab cd ef kg", "kg ef cd Ab".ChangeWordOrder());
        }
    }
}